﻿

using HBase;
using Microsoft.VisualBasic;

namespace hCommand {
    public class WMSBaseTransFacade {


        static WcsTaskNoEngine taskNoEngine = new WcsTaskNoEngine();
        static WcsMoveTask wcsMoveTask = new WcsMoveTask();
        static WcsMoveAgvEmplyTask wcsMoveAgvEmplyTask = new WcsMoveAgvEmplyTask();

        static WcsDeleteTaskEngine deleteTaskEngine = new WcsDeleteTaskEngine();
        


        public static TransRes doDeleteTaskEngine(long taskId) {
            lock (BaseConfig.transLockObj) {

                deleteTaskEngine.paramId = taskId;

                TransRes res = deleteTaskEngine.doWork();
                return res;

            }
        }
        public static int getTaskNo() {
            lock (BaseConfig.transLockObj) {

                TransRes res = taskNoEngine.doWork();
                return taskNoEngine.taskNo;
            }
        }
        public static bool doWcsMoveAgvEmplyTask(long beforeParamId, long paramId, int src, int des) {
            lock (BaseConfig.transLockObj) {
                wcsMoveAgvEmplyTask.beforeParamId = beforeParamId;
                wcsMoveAgvEmplyTask.paramId = paramId;
                wcsMoveAgvEmplyTask.src = src;
                wcsMoveAgvEmplyTask.des = des;
                TransRes res = wcsMoveAgvEmplyTask.doWork();
                return res.s;
            }
        }
            public static bool doWcsMoveTask( int src ,int des,string waveNO="",string info="") {
            
            long cId = WMSIdUtil.getId();
            long paramId = WMSIdUtil.getId();
            lock ( BaseConfig.transLockObj ) {
                wcsMoveTask.completeId = cId;
                wcsMoveTask.paramId = paramId;
                wcsMoveTask.src = src;
                wcsMoveTask.des = des;
                wcsMoveTask.waveNo = waveNO;
                wcsMoveTask.info= info; 
                TransRes res = wcsMoveTask.doWork();
                return res.s;
            }
        }


    }
}
